package cn.cycleif.component.file;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

/**
 * &#064;Date: 24/06/09-14:20
 * &#064;Description:
 */
@Service
@RequiredArgsConstructor
public class FileUploadContext {

  private final Map<String, FileUploadStrategy> fileUploadStrategy;

  public String upload(String mode, MultipartFile file) {
    return fileUploadStrategy.get(mode).upload(file);
  }

  public Boolean remove(String mode, String... keys) {
    return fileUploadStrategy.get(mode).remove(keys);
  }

}
